package com.cloudkeeper.leasing.identity.repository;

import com.cloudkeeper.leasing.identity.domain.DetectionIndex;
import com.cloudkeeper.leasing.base.repository.BaseRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.annotation.Nonnull;
import java.util.List;
import java.util.Map;

/**
 * 监测指标 repository
 * @author asher
 */
@Repository
public interface DetectionIndexRepository extends BaseRepository<DetectionIndex> {

    DetectionIndex findByDistrictIdAndTaskId(@Nonnull String districtId,@Nonnull String taskId);

    // 拿出某个考核任务的政治站位字段集合
    @Query(value = "select districtId, field1 from Detection_Index WHERE taskId = :taskId and (field1 = '差' or field1 = '一般')", nativeQuery = true)
    List<Map> findAllPolicyByTaskId(String taskId);
}
